﻿namespace WMS6.Services
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.ServiceModel;
    using System.ServiceModel.Activation;
    using WMS6.BLL;
    using WMS6.Common;
    using WMS6.DataEntity;

    [AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed), ServiceBehavior(InstanceContextMode=InstanceContextMode.PerCall)]
    public class TransportMgtDetailService : ITransportMgtDetailService
    {
        public string DeleteDeliveryOrderDetailInfo(List<string> deliveryOrderDetailIDs, List<string> lineIDs, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new DeliveryOrderDetailBLL(pubParasInfo).DeleteDetail(deliveryOrderDetailIDs, lineIDs, null);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtDetailService_DeleteDeliveryOrderDetailInfo", deliveryOrderDetailIDs, lineIDs, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TransportMgtDetailService异常");
            }
            return temp;
        }

        public string DeleteDispatchDetailInfo(List<string> dispatchDetailInfoIDs, List<string> lineIDs, PubParasInfo pubParasInfo)
        {
            string lineID = string.Empty;
            try
            {
                lineID = new DispatchDetailBLL(pubParasInfo).DeleteDetail(dispatchDetailInfoIDs, lineIDs, null);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtDetailService_DeleteDispatchDetailInfo", dispatchDetailInfoIDs, lineIDs, pubParasInfo);
                return lineID;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TransportMgtDetailService异常");
            }
            return lineID;
        }

        public string DeletePodDetailInfo(List<string> podIDs, List<string> lineIDs, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new PodDetailBLL(pubParasInfo).DeleteDetail(podIDs, lineIDs, null);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtDetailService_DeletePodDetailInfo", podIDs, lineIDs, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TransportMgtDetailService异常");
            }
            return temp;
        }

        public DataSet GetAllDeliveryOrderDetailInfo(PubParasInfo pubParasInfo)
        {
            try
            {
                DeliveryOrderDetailBLL deliveryOrderDetailBll = new DeliveryOrderDetailBLL(pubParasInfo);
                return deliveryOrderDetailBll.GetAllDetailInfo();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TransportMgtDetailService异常");
            }
            return null;
        }

        public DataSet GetAllDispatchDetailInfo(PubParasInfo pubParasInfo)
        {
            try
            {
                DispatchDetailBLL dispatchDetailBll = new DispatchDetailBLL(pubParasInfo);
                return dispatchDetailBll.GetAllDetailInfo();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TransportMgtDetailService异常");
            }
            return null;
        }

        public DataSet GetAllPodDetailInfo(PubParasInfo pubParasInfo)
        {
            try
            {
                PodDetailBLL podDetailBll = new PodDetailBLL(pubParasInfo);
                return podDetailBll.GetAllDetailInfo();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TransportMgtDetailService异常");
            }
            return null;
        }

        public List<DeliveryOrderAndDispatchDataInfo> GetDeliveryOrderAndDispatchDataInfoListByIDs(List<string> deliveryOrderIDs, PubParasInfo pubParasInfo)
        {
            List<DeliveryOrderAndDispatchDataInfo> deliveryOrderAndDispatchDataInfos = new List<DeliveryOrderAndDispatchDataInfo>();
            try
            {
                DeliveryOrderDetailBLL deliveryOrderDetailBll = new DeliveryOrderDetailBLL(pubParasInfo);
                return deliveryOrderDetailBll.GetDetailInfoListByIDs(deliveryOrderIDs);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TransportMgtDetailService异常");
            }
            return deliveryOrderAndDispatchDataInfos;
        }

        public DeliveryOrderDetailInfo GetDeliveryOrderDetailInfoByID(string deliveryOrderID, string lineID, PubParasInfo pubParasInfo)
        {
            DeliveryOrderDetailInfo deliveryOrderDetailInfo = new DeliveryOrderDetailInfo();
            try
            {
                DeliveryOrderDetailBLL deliveryOrderDetailBll = new DeliveryOrderDetailBLL(pubParasInfo);
                return deliveryOrderDetailBll.GetDetailInfoByID(deliveryOrderID, lineID, "");
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TransportMgtDetailService异常");
            }
            return deliveryOrderDetailInfo;
        }

        public List<DeliveryOrderDetailInfo> GetDeliveryOrderDetailInfoListByID(string deliveryOrderID, PubParasInfo pubParasInfo)
        {
            List<DeliveryOrderDetailInfo> deliveryOrderDetailInfos = new List<DeliveryOrderDetailInfo>();
            try
            {
                DeliveryOrderDetailBLL deliveryOrderDetailBll = new DeliveryOrderDetailBLL(pubParasInfo);
                return deliveryOrderDetailBll.GetDetailInfoListByID(deliveryOrderID, "");
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TransportMgtDetailService异常");
            }
            return deliveryOrderDetailInfos;
        }

        public DispatchDetailInfo GetDispatchDetailInfoByID(string dispatchDetailInfoID, string lineID, PubParasInfo pubParasInfo)
        {
            DispatchDetailInfo dispatchDetailInfo = new DispatchDetailInfo();
            try
            {
                DispatchDetailBLL dispatchDetailBll = new DispatchDetailBLL(pubParasInfo);
                return dispatchDetailBll.GetDetailInfoByID(dispatchDetailInfoID, lineID, "");
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TransportMgtDetailService异常");
            }
            return dispatchDetailInfo;
        }

        public List<DispatchDetailInfo> GetDispatchDetailInfoListByID(string dispatchDetailInfoID, PubParasInfo pubParasInfo)
        {
            List<DispatchDetailInfo> dispatchDetailInfos = new List<DispatchDetailInfo>();
            try
            {
                DispatchDetailBLL dispatchDetailBll = new DispatchDetailBLL(pubParasInfo);
                return dispatchDetailBll.GetDetailInfoListByID(dispatchDetailInfoID, "");
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TransportMgtDetailService异常");
            }
            return dispatchDetailInfos;
        }

        public PodDetailInfo GetPodDetailInfoByID(string podID, string lineID, PubParasInfo pubParasInfo)
        {
            try
            {
                PodDetailBLL podDetailBll = new PodDetailBLL(pubParasInfo);
                return podDetailBll.GetDetailInfoByID(podID, lineID, "");
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TransportMgtDetailService异常");
            }
            return null;
        }

        public List<PodDetailInfo> GetPodDetailInfoListByID(string podID, PubParasInfo pubParasInfo)
        {
            try
            {
                PodDetailBLL podDetailBll = new PodDetailBLL(pubParasInfo);
                return podDetailBll.GetDetailInfoListByID(podID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TransportMgtDetailService异常");
            }
            return null;
        }

        public string InsertDeliveryOrderDetailInfo(DeliveryOrderDetailInfo deliveryOrderDetailInfo, PubParasInfo pubParasInfo)
        {
            string lineID = string.Empty;
            try
            {
                lineID = new DeliveryOrderDetailBLL(pubParasInfo).InsertDetail(deliveryOrderDetailInfo);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtDetailService_InsertDeliveryOrderDetailInfo", deliveryOrderDetailInfo, pubParasInfo);
                return lineID;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TransportMgtDetailService异常");
            }
            return lineID;
        }

        public string InsertDispatchDetailInfo(DispatchDetailInfo dispatchDetailInfo, PubParasInfo pubParasInfo)
        {
            string lineID = string.Empty;
            try
            {
                lineID = new DispatchDetailBLL(pubParasInfo).InsertDetail(dispatchDetailInfo);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtDetailService_InsertDispatchDetailInfo", dispatchDetailInfo, pubParasInfo);
                return lineID;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TransportMgtDetailService异常");
            }
            return lineID;
        }

        public string InsertPodDetailInfo(PodDetailInfo podDetailInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new PodDetailBLL(pubParasInfo).InsertDetail(podDetailInfo);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtDetailService_InsertPodDetailInfo", podDetailInfo, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TransportMgtDetailService异常");
            }
            return temp;
        }

        public string UpdateDeliveryOrderDetailInfo(DeliveryOrderDetailInfo deliveryOrderDetailInfo, PubParasInfo pubParasInfo)
        {
            string lineID = string.Empty;
            try
            {
                lineID = new DeliveryOrderDetailBLL(pubParasInfo).UpdateDetail(deliveryOrderDetailInfo);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtDetailService_UpdateDeliveryOrderDetailInfo", deliveryOrderDetailInfo, pubParasInfo);
                return lineID;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TransportMgtDetailService异常");
            }
            return lineID;
        }

        public string UpdateDispatchDetailInfo(DispatchDetailInfo dispatchDetailInfo, PubParasInfo pubParasInfo)
        {
            string lineID = string.Empty;
            try
            {
                lineID = new DispatchDetailBLL(pubParasInfo).UpdateDetail(dispatchDetailInfo);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtDetailService_UpdateDispatchDetailInfo", dispatchDetailInfo, pubParasInfo);
                return lineID;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TransportMgtDetailService异常");
            }
            return lineID;
        }

        public string UpdatePodDetailInfo(PodDetailInfo podDetailInfo, PubParasInfo pubParasInfo)
        {
            string temp = string.Empty;
            try
            {
                temp = new PodDetailBLL(pubParasInfo).UpdateDetail(podDetailInfo);
                new OperationLogBLL(pubParasInfo).Insert("TransportMgtDetailService_UpdatePodDetailInfo", podDetailInfo, pubParasInfo);
                return temp;
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "TransportMgtDetailService异常");
            }
            return temp;
        }
    }
}

